package model.excel;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
@ContentRowHeight(15)
@ContentFontStyle(fontHeightInPoints = 11)
public class LogisticsExcel {
    @ExcelProperty(value = {"冷链物流配送需求表","客户基本信息及配送要求"})
    @ColumnWidth(10)
    private String no;

    @ExcelProperty(value = {"冷链物流配送需求表","客户基本信息及配送要求"})
    @ColumnWidth(50)
    private WriteCellData<String> item;

    @ExcelProperty(value = {"冷链物流配送需求表","客户基本信息及配送要求"})
    @ColumnWidth(45)
    private WriteCellData<String> content;

    @ExcelProperty(value = {"冷链物流配送需求表","备注"})
    @ColumnWidth(20)
    private String remark;

    // 用于存储扩展数据的Map
    @ExcelIgnore
    private Map<String, Object> extendedData = new HashMap<>();
    
    // 高亮标志：1 = 高亮，0 = 不高亮
    @ExcelIgnore
    private String highlight = "0";
    
    // 获取扩展数据
    public Map<String, Object> getExtendData() {
        if (extendedData == null) {
            extendedData = new HashMap<>();
        }
        // 将highlight添加到扩展数据中
        extendedData.put("highlight", highlight);
        return extendedData;
    }
    
    // 设置高亮状态
    public void setHighlight(boolean isHighlighted) {
        this.highlight = isHighlighted ? "1" : "0";
    }

    public String getSerialNo() {
        return no;
    }

    public void setSerialNo(String serialNo) {
        this.no = serialNo;
    }

    public WriteCellData<String> getItem() {
        return item;
    }

    public void setItem(String item) {
        this.item = new WriteCellData<>(item);
    }

    public void setItemCellStyle(WriteCellStyle style) {
        if (this.item == null) {
            this.item = new WriteCellData<>("");
        }
        this.item.setWriteCellStyle(style);
    }

    public WriteCellData<String> getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = new WriteCellData<>(content);
    }

    public void setContentCellStyle(WriteCellStyle style) {
        if (this.content == null) {
            this.content = new WriteCellData<>("");
        }
        this.content.setWriteCellStyle(style);
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
} 